home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 018a / amac41.zip / COM003.QM < prev    next >
Text File  |  1991-08-26  |  22KB  |  455 lines

  1. *                               COM003.QM
  2. *                        Written By Tom Hogshead
  3. *                       [ See COMTxx.QM For Use ]
  4. *                                 8/8/91
  5. *  Key                         Description
  6. * =====   ===============================================================
  7. * @(8)    Insert Text at Beginning of Blocked Lines (or Current
  8. *         Line If No Blocks Marked), John Goodman, Author
  9. *
  10. * #(F4__)-Surround Column-Blocked Text With Box Of Desired Characters,
  11. *             (John Goodman, Author)
  12. *                                   ********
  13. *         (Box Drawn Around Outside *Border* Of Column Block, Juxtapose Text)
  14. *                                   ********
  15. *
  16. * @(F4)  -Erase Outside Border Of Column-Blocked Text And Collapse Text
  17. *         Surronding Block To Original Position Before Box Was Made,
  18. *             (John Goodman, Author)
  19. *
  20. * @(F8) --Put Colon In Front Of "Rem" Lines For Faster Batch File Operation
  21. *
  22. * ^(F7_)--Prepend Prompted Text To, Or Delete Prompted Text From,
  23. *         The Beginning Of The Current Or Blocked Line(s),
  24. *             (John Goodman, Author)
  25. *
  26. * #(F7__)-Prepend Prompted Text To, Or Delete Prompted Text From,
  27. *         The Beginning Of The Current Or Blocked Line(s),
  28. *         Initialize Find Prompt With Last Prompted Text
  29. *             (Tom Hogshead Modification Of ^F7)
  30. *
  31. * @(F7) --Insert Text At Beginning Of All Blocked Lines,
  32. *             (John Goodman, Author)
  33. *
  34. *
  35. *  (_)  --{e:\up\COMT*}--Return To COMTxx.QM
  36. *
  37. *-- eoi
  38.  
  39. *
  40.  
  41. * 
  42. * ----------------------------------------------------------------------
  43. * #(F4__) Surround Column-Blocked Text with Box of Desired Characters,
  44. *         John Goodman, author
  45.                                    ********
  46. *        (Box Drawn Around Outside *Border* of Column Block, Juxtapose Text)
  47.                                    ********
  48. * ----------------------------------------------------------------------
  49. * The following macro surrounds column-blocked text with a box of desired
  50. * characters. Place text to be surrounded in a column block and press
  51. * #F4. At the FillBlock prompt enter the desired border character. Box
  52. * size is unlimited, including empty boxes, and boxes of one character
  53. * up to surrounding full documents.  Macro is INSERT mode insensitive,
  54. * and there are no Find beeps because of failed searches. This macro
  55. * was written by John Goodman.
  56.  
  57. * Starting with a block like this:
  58.  
  59. *         12345678901234567890
  60. *         12345678901234567890
  61. *         12345678901234567890
  62. *         12345678901234567890
  63. *         12345678901234567890
  64.  
  65. * Macro #F4 does this . . .
  66.  
  67. *         12345678901234567890
  68.                **********
  69. *         12345*67890123*4567890
  70. *         12345*67890123*4567890
  71. *         12345*67890123*4567890
  72.                **********
  73. *         12345678901234567890
  74.  
  75. #F4  macrobegin
  76.     GotoBlockBeg            * Try going to block beg
  77.  JTrue START:               * If we can, start processing
  78.     MarkColumn              * Try completing the block
  79.     GotoBlockBeg            * Try again to go to block beg
  80.  JFalse END:                * If we can't, no block there
  81.  START:
  82.     Copy PasteOver          * Copy the block and paste it back
  83.     InsertLine              * Insert blank line at top
  84.     MarkLine                * Make column block a line block
  85.     GotoBlockEnd            * (Line) block end is directly below!
  86.     MarkColumn              * Start a single column block
  87.     PrevPosition            * Go back to where block began
  88.     CopyBlock CopyBlock     * Copy column twice to shift text
  89.     CursorDown              * Move down to reset block position
  90.     PasteOver               * Paste orig block back in
  91.     CursorUp                * Move to upper right of outer block
  92.     MarkColumn              * Reset upper right corner
  93.     GotoBlockEnd            * Go to block end
  94.     CursorRight             * Move to where outer block will end
  95.     AddLine                 * Add extra line at bottom
  96.     MarkColumn              * Mark outer block end point
  97.     FillBlock Pause Return  * Prompt user for fill character
  98.     GotoBlockBeg            * Go to outer block begin
  99.     CursorDown CursorRight  * Move in for inner block
  100.     PasteOver               * Put original block back in
  101.     UnmarkBlock             * Clean up and go home!
  102.  END:
  103. *
  104. * 38 bytes Tue  05-07-1991  17:46:32
  105.  
  106. * 
  107. * ----------------------------------------------------------------------
  108. * @(F4)    Erase Outside Border of Column-Blocked Text and Collapse Text
  109. *          Surronding Block to Original Position Before Box Was Made
  110. *          John Goodman, author
  111. * ----------------------------------------------------------------------
  112. * Mark box border as a column block. @F4 erases outside border, returns
  113. * and collapses all text surrounding block to original position before
  114. * box was made.  Use with caution since the lines containing the top
  115. * and bottom edges of the block are deleted.
  116.  
  117. @F4 MacroBegin
  118.     GotoBlockBeg             * Try going to block begin
  119.  JTrue START:                * If we can, begin processing
  120.     MarkColumn               * If not, mark block end
  121.     GotoBlockBeg             * Try again to go to block begin
  122.  JFalse END:                 * If we can't, no block
  123.  START:
  124.     ShiftRight               * Remove right edge of box
  125.     GotoBlockEnd             * Go to end of block
  126.     MarkLine                 * Start Line block
  127.     PrevPosition             * Return to block begin
  128.     GotoBlockEnd             * new block end is directly below
  129.     MarkColumn               * Start single column block
  130.     PrevPosition             * Return to old block begin
  131.     CursorRight              * Create 2-column block
  132.     MarkColumn               * Finish marking block
  133.     DelLine                  * Delete top edge of box
  134.     GotoBlockEnd             * Go to last line of block
  135.     DelLine                  * Delete bottom edge of box
  136.     DeleteBlock              * Delete 1st two columns of block
  137.  END:
  138. *
  139. * 26 bytes Wed  05-08-1991  15:36:31
  140.  
  141. * 
  142. * ---------------------------------------------------------------
  143. * @(F7)  Insert Text at Beginning of All Blocked Lines (J GOODMAN)
  144. * ---------------------------------------------------------------
  145. *
  146. @F7 MacroBegin
  147.         CursorRight           * Needed for single-line blocks
  148.         GotoBlockBeg          * Try going to block beg, retain pos.
  149.    JTrue BLK:                 * Determine if a completed block
  150.         DropAnchor            * If not, DropAnchor will finish it
  151.                               * or mark current line if none started
  152.         GotoBlockBeg          * Go to block beg to retain position
  153.    BLK: GotoBlockEnd          * Start at the end
  154.         FindReplace           * Dummy to Allow for Safe Macro Escape
  155.           #224 Return         *  Char Unlikely to be Found
  156.           Pause Return        *  Allow User to Enter Repl Text
  157.           "LN" Return         *  Local, No Prompt Replace
  158.         MarkLine              * Mark first line
  159.         PrevPosition          * Return to beg of where block was
  160.         ShiftRight            * Shift all lines to right
  161.         BegLine               * Move cursor to column 1
  162.         GotoBlockEnd          * Move to 1st char of last line
  163.         MarkColumn            * Mark 1st character column
  164.         PrevPosition          * Return to first line
  165.         BegLine               * Needed for single-line blocks
  166.         FillBlock             * Fill First Column with Char
  167.           #224 Return         *  Searched For Above
  168.         RepeatFind            * Repeat the FindReplace
  169.         UnmarkBlock           * Unmark the block
  170. * 37 bytes Wed  04-17-1991  21:02:33
  171.  
  172. * =========================================================================
  173. * Date: 05-01-91 (00:21)           Number: 275          SemWare Support BBS
  174. *   To: TOM HOGSHEAD               Refer#: NONE
  175. * From: JOHN GOODMAN                 Read: NO
  176. * Subj: MORE FOR REX                 Conf: 3 Macros
  177. * ------------------------------------------------------------------------
  178. * To Tom and Rex Edwards--
  179. *
  180. * Rex, I'm glad you're finding the comment macros useful!  I hope
  181. * Tom's followup comments will do the trick for you; I couldn't
  182. * have recommended anything better.
  183. *
  184. *» Not to let Tom have the last word, however...
  185. *» The following macro is a first (very rough) attempt to merge
  186. *» together the ideas in the comment/uncomment macro and the macro
  187. *» that prepends a user-prompted string of text to blocked lines or
  188. *» the current line (the idea for the second macro originated with
  189. *» Richard Blackburn and it has been refined since then--I'm not
  190. *» sure where Tom has put it in the AMAC files).
  191. * The macro below works the same as the comment/uncomment macro
  192. * except that it will prompt for a text string.  If the text string
  193. * is found at the beginning of the 1st line of the block, the macro
  194. * will delete that number of characters from the beginning of every
  195. * line in the block.  If the string is not found, it will add the
  196. * string to the beginning of every line in the block.
  197. *
  198. */ I have not had a chance to thoroughly test the macro or to try to
  199. */ streamline it, but I wanted to throw it out for comment (sic).
  200. */
  201. * >>Tom, I'm running up against a deadline here at my real (i.e.,
  202. * >>paying) job and may not be able to provide any further input on
  203. * >>the JMPPOS macros for a couple of days.  I scanned the last set
  204. * >>you sent and everything looks great!  Please don't let me hold
  205. * >>you up if you want to get it out quickly.
  206. * >>
  207. * >>...JDG
  208. *
  209. * (Comments above added, deleted, then added again by #F7)                |1.5
  210.  
  211. * 
  212. * -------------------------------------------------------------------
  213. * ^(F7_) Prepend Prompted Text to, or Delete Prompted Text from,
  214. *      The Beginning of the Current or Blocked Line(s)
  215. * -------------------------------------------------------------------
  216. * (Note: I have changed John's character #128 to @250 so as to not be as
  217. *  noticeable.)
  218.  
  219. ^F7   MacroBegin
  220.       CursorRight           * Needed for single-line blocks
  221.       GotoBlockBeg          * Try going to block beg, retain pos.
  222.  JTrue BLK:                 * Determine if a completed block
  223.       DropAnchor            * If not, DropAnchor will finish it
  224.                             * or mark current line if none started
  225.       GotoBlockBeg          * Go to block beg to retain position
  226.  BLK: GotoBlockEnd          * Start at the end
  227.       MarkLine              * Mark line to close block
  228.       PrevPosition          * Return to block begin
  229.       ShiftRight            * Shift all lines to right
  230.       BegLine               * Move cursor to column 1
  231.       GotoBlockEnd          * Move to 1st char of last line
  232.       MarkColumn            * Mark 1st character column
  233.       PrevPosition          * Return to first line
  234.       BegLine               * Needed for single-line blocks
  235.       FillBlock             * FillBlock w/weird character
  236.        #250 Return
  237.       FindReplace           * Replace Weird Char on 1st Line
  238.        #250 Return          *  with user-prompted text
  239.        DelLine
  240.        Pause #250 Return
  241.        "1" Return           *  1st Occurrence (Line) Only
  242.       UnmarkBlock           * Unmark the block
  243.       CursorLeft
  244.       MarkCharacter         * Block the User's Text
  245.       BegLine
  246.       Cut                   * Cut Buffer Now Has Prompted Text
  247.       AddLine Paste         * Save text on the following line
  248.       Find #250 Paste Return  * Try to find weird char+text
  249.        "B" Return             *  on 1st line
  250.  JTrue DELTEXT:
  251.                               * Text not found, add to every line
  252.       DelLine                 * Delete temp line
  253.       FindReplace #250 Return * Replace all occurrences of weird
  254.        Paste Return           *  char with user's text
  255.        "GN" Return
  256.  Jump END:
  257.  DELTEXT:                     * Text not found, shift right
  258.       GotoBlockEnd            * Go to end of saved copy
  259.       DelLine                 * get rid of temp line
  260.       CursorUp                * go back to 1st line in same col
  261.       MarkColumn              * start col block, upper right
  262.       Find #250 Return        * find last weird char, this becomes
  263.        "GB" Return            *  lower left corner of col block
  264.       DeleteBlock             * delete the column block
  265.       CursorDown              * reposition to run again
  266.  END:
  267. *
  268. * 84 bytes Tue  04-30-1991  23:51:49
  269.  
  270. * 
  271. * -------------------------------------------------------------------
  272. * #(F7__) Prepend Prompted Text to, or Delete Prompted Text from,
  273. *         The Beginning of the Current or Blocked Line(s),
  274. *         Initialize Find prompt with last prompted text
  275. * -------------------------------------------------------------------
  276. * I changed John's ^F7 macro a bit so that the last prompt is
  277. * remembered by Find. This is helpful for repetitive entries.
  278.  
  279. #F7   MacroBegin
  280.       CursorRight           * Needed for single-line blocks
  281.       GotoBlockBeg          * Try going to block beg, retain pos.
  282.  JTrue BLK:                 * Determine if a completed block
  283.       DropAnchor            * If not, DropAnchor will finish it
  284.                             * or mark current line if none started
  285.       GotoBlockBeg          * Go to block beg to retain position
  286.  BLK: GotoBlockEnd          * Start at the end
  287.       MarkLine              * Mark line to close block
  288.       PrevPosition          * Return to block begin
  289.       ShiftRight            * Shift all lines to right
  290.       BegLine               * Move cursor to column 1
  291.       GotoBlockEnd          * Move to 1st char of last line
  292.       MarkColumn            * Mark 1st character column
  293.       PrevPosition          * Return to first line
  294.       BegLine               * Needed for single-line blocks
  295.       FillBlock             * FillBlock w/weird character
  296.        #250 Return
  297.       FindReplace           * Replace Weird Char on 1st Line
  298.        #250 Return          *  with user-prompted text
  299. *       DelLine
  300.        CursorRight                                                    *|
  301.        Pause #250 Return
  302.        "1" Return           *  1st Occurrence (Line) Only
  303.       UnmarkBlock           * Unmark the block
  304.       CursorLeft
  305.       MarkCharacter         * Block the User's Text
  306.       BegLine
  307.       Cut                   * Cut Buffer Now Has Prompted Text
  308.       AddLine Paste         * Save text on the following line
  309.       Find #250 Paste Return  * Try to find weird char+text
  310.        "B" Return             *  on 1st line
  311.  JTrue DELTEXT:
  312.                               * Text not found, add to every line
  313.       DelLine                 * Delete temp line
  314.       FindReplace #250 Return * Replace all occurrences of weird
  315.        Paste Return           *  char with user's text
  316.        "GN" Return
  317.  Jump END:
  318.  DELTEXT:                     * Text not found, shift right
  319.       GotoBlockEnd            * Go to end of saved copy
  320.       DelLine                 * get rid of temp line
  321.       CursorUp                * go back to 1st line in same col
  322.       MarkColumn              * start col block, upper right
  323.       Find #250 Return        * find last weird char, this becomes
  324.        "GB" Return            *  lower left corner of col block
  325.       DeleteBlock             * delete the column block
  326.       CursorDown              * reposition to run again
  327.  END:                         *
  328.       FindReplace Return      *                                       *|
  329.       Paste                   * Re-initialize Find prompt with        *|
  330.                               *  prompted text                        *|
  331.       Return Escape           * Cancel FindReplace                    *|
  332. *
  333. * 84 bytes Tue  04-30-1991  23:51:49 (JG ^F7)
  334. * 89 bytes Thu  05-02-1991  10:24:01 (TH |)
  335.  
  336. * 
  337. * ---------------------------------------------------------------------
  338. * @(F8)  Put colon in front of *rem* line for faster batch file operation
  339. * ---------------------------------------------------------------------
  340. * "Rem" lines in batch files make batch files run slower. Lines which
  341. * are labels (colon as first character) do not. This macro simply puts
  342. * a colon in column 1 for each line containing "rem ". Each rem line
  343. * for my system takes about 0.2 seconds with disk cache, and 0.5 seconds
  344. * per line with no disk cache. I found one batch file with 30 plus
  345. * rem lines - 15 seconds less running time by labelling rem lines!
  346. *
  347. * NOTE:  At least a space and one character of text must follow "rem"
  348. * to be labelled, eg the following would not be labeled:
  349. *       rem
  350. *       echo remember
  351. * The following would be labeled:
  352. *       rem  this is a test
  353. *       echo harem holiday!
  354. *              
  355. *
  356. @F8     MacroBegin                      *
  357.         Begfile InsertLine              * Insert blank line in case
  358.                                         * rem in col/line 1/1
  359.         Editfile "c:\!" Return          * Load temp file
  360.         KillFile Quit                   * To kill/quit it
  361.         EditFile Return                 * Load empty temp file and
  362.         SaveFile                        * save it for append later
  363.         Quit                            * Quit it for now
  364.  START:                                 *
  365.         Unmarkblock                     *
  366.         Find "rem " Return "I " Return  * Find "rem "
  367.         Jfalse END:                     * No rem lines, end macro
  368.         BegLine                         *ELSE line has rem, go to bol
  369.         Dropanchor Wordright Dropanchor * Mark space up to "rem"
  370.         Shiftright                      * Shift line rt one space
  371.         Begline                         * Bak to bol
  372.         Find ":" Return "L" Return      * See if line has colon at beg
  373.         Jtrue NEXT:                     *
  374.         Cursorright ":"                 *ELSE line has no colon, add it!
  375.  NEXT:                                  *
  376.         Shiftleft                       * Shift line back lft one space
  377.         Markline                        *
  378.         WriteBlock Return "A"           * Append line to c:\!
  379.         Endline Cursordown              * Move off rem and chk for last
  380.         Jfalse END:                     *                          line
  381.         Cursorup                        *ELSE Line is not last, cur up
  382.         Jump START:                     * Loop again
  383.  END:                                   *
  384.         Begfile                         * Begin of batch file
  385.         DelLine                         * Delete top blank line
  386.         Editfile Return                 * Load c:\!, look at rem lines
  387.         DelLine KillFile                * with added colon, kill file
  388.         UnMarkBlock                     * Un mark batch file
  389.  
  390. *
  391. * 82 bytes Mon  03-25-1991  16:49:26
  392.  
  393. * 
  394. * -----------------------------------------------------------
  395. * @(8) Insert Text at Beginning of Blocked Lines (or Current
  396. *      Line If No Blocks Marked)
  397. *      John Goodman, Author
  398. * -----------------------------------------------------------
  399. * This macro will insert a user-prompted string of text in front of
  400. * each line delineated by any type of block (character, line, or
  401. * column).  Only one block marker need be set.  If no block markers
  402. * are set, the current line will be acted upon.  The text to be
  403. * prepended should be entered by the user at the "Replace with:"
  404. * prompt.
  405. *
  406. * The cursor will be placed at the beginning of the line following
  407. * the line(s) acted upon so that the macro can be invoked
  408. * repeatedly to prepend text to a series of lines.  The macro
  409. * should work consistently regardless of toggle mode or QConfig
  410. * settings.
  411. *
  412. @8 MacroBegin
  413.         CursorRight     * Needed for single-line blocks
  414.         GotoBlockBeg    * Try going to block beg, retain pos.
  415.    JTrue BLK:           * Determine if a completed block
  416.         DropAnchor      * If not, DropAnchor will finish it
  417.                         * or mark current line if none started
  418.         GotoBlockBeg    * Go to block beg to retain position
  419.    BLK: GotoBlockEnd    * Start at the end
  420.         FindReplace     * Dummy to Allow for Safe Macro Escape
  421.           #250 Return   *  Char Unlikely to be Found
  422.           DelLine       *  Erase old prompt
  423.           Pause Return  *  Allow User to Enter Repl Text
  424.           "LN" Return   *  Local, No Prompt Replace
  425.         MarkLine        * Mark first line
  426.         PrevPosition    * Return to beg of where block was
  427.         ShiftRight      * Shift all lines to right
  428.         BegLine         * Move cursor to column 1
  429.         GotoBlockEnd    * Move to 1st char of last line
  430.         MarkColumn      * Mark 1st character column
  431.         PrevPosition    * Return to first line
  432.         BegLine         * Needed for single-line blocks
  433.         MarkColumn      * Finish marking block
  434.         FillBlock       * Fill First Column with Char
  435.           #250 Return   *  Searched For Above
  436.         RepeatFind      * Repeat the FindReplace
  437.         GotoBlockEnd    * Go to the last line
  438.         UnmarkBlock     * Unmark the block
  439.         BegLine         * Return to beginning of line
  440.         CursorDown      * Go to next line
  441. *
  442. * 42 bytes Sat  07-27-1991  23:43:18 (JG)
  443.  
  444. * QCONFIG.DAT version of @8 above.  Uncomment the lines and merge
  445. * them together into a single line before placing in QCONFIG.DAT.
  446.  
  447. * @8 MacroBegin CursorRight GotoBlockBeg JTrue BLK: DropAnchor
  448. * GotoBlockBeg BLK: GotoBlockEnd FindReplace #250 Return DelLine
  449. * Pause Return "LN" Return MarkLine PrevPosition ShiftRight BegLine
  450. * GotoBlockEnd MarkColumn PrevPosition BegLine MarkColumn FillBlock
  451. * #250 Return RepeatFind GotoBlockEnd UnmarkBlock BegLine CursorDown
  452.  
  453.